﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101700710102";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCedKDcgbTIB0vZRMdUBD8rLfosU7y4riwRXYLcZ1X9o5mUgCwU8FNY84gVaTx1tvaEoNBJQDLADLzbvwFuvu+c/qJfnkIRGnLlg5NSeO27H5R7cttUIUUJ9014HDRpYN3UMZ43DWNmJ4oEuAspb8mLeP2zCEQFOZCLa5sqdknalZxRa/Lroy78cAUg4MW2CDTjM9H5ThQ8wPndgFpR73/Fm/eJnWuWl7qeo9vCu/Yp+07+2omLaOEXpmtQCxg7uPOexeGLj8et08r5OIUXbMyg/FD1sRUVQo2Pduf+YWB+one6q+5EzamTAeYS6Ys0I6PxEGssVfE7MISZy466FkIBAgMBAAECggEAXXIYP5I6g9BRucLm7jRG8Hb/105WuG72zBLijopeWuM1Oi9QT9TewlF0SnQyVJVe0h5oVxqGE14vrkP5W088zdAY/9y7x4xaf+HVasioIjdggGDe2cF5DoSKai/v9MlMaMwOKxc5LFBbA6dp5bjoGdlzfDZ+rrog9SezbRovObkcu+QnvHTT8Fyk1pHkIVgQym0p94Cf+rCdvYgFYbWeSzxXGmU2AHJIG82I64vBFb/Mp1m0ZrEPLYkVyrWT1+EldA7LbB8e4PAxETRIYBTpD1y1IvJW1XSDfoGgt9gDiStU7sL2RgFhBg/2TT2nRADWmVtutjs6fSxPh2ThSf0Q5QKBgQDdwfLm5uCgLSbo+LjLwZqiFoa1jPtnIIzb/im4RuP75Tk/0UPs2E4Pe6SW0Ax26IdSA4aE143HdsIp01PAhGKzHM7V/0xOctg1/xshnLNaaprGTq/WrjOBZd/K5biSOIryzDbxbvCTwkm4gBvCgnIKNFm+r3XN1JhiX8p+HV5EzwKBgQC27FuiLJdeXNLr9GTDo4ZP50HqtS4On1ez/BZARACXtXkVbXWz7xv7JpAlI+9di1QBmPT/Bf5W0jCw+pqlIZFyKF75gxe+aHlVSZBfWbQKTexZ/X6DT3neVub+gvIAflx4smTRpHJFXuQXQb48GELk9h8A47BzCqpAZJeJtuZgLwKBgQDUy0/zEolqKumzlTh/DYD9GPCbNnXoN+vzDqmqExyikwukmYK8u7PsV5FQxsOvNuLjaE6lGtMKHIOk7wznKCIuDe7Mmvb2MG4ZIns+fcf9c16h/M/vCaqS+NcPM/ExHuD2q8/tTa+9mipzyTraI6Ka+DFGMcixgtfXTmRZMIVNMQKBgEe37cls0EA4Bp5qaKNn1r43PlnmhVNIWBuCJ7s0rkLM7Ndg3jgY9JCIsxVMvImhmeMydEQUtn6V1G9fIgjCW4M1nt8W7dVCoue0ev1Xb0Zm/Nbfk52qKG7rBZAeCQH2iQztbKfhYMggBy+zIAHxxTB96vPvUXwZX1z105Az/KkTAoGAaJJvJ2dVPPxgTJo7JxIn/6hhaivo9yhO//Vmh3dYPh8p37tOq4Z608my0EU7tLofnfy5cWrz52O2mtDeEAvEXB5qTFLEcLiyNkBuppwDcf9EVVSsrvX9vGNUBVuwikwgbco58lPG4Deof2ULTw3P1pCNzXxr2aT6oN6neLyo70s=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF+70t2bmEmL168Rbu0gM9kpSS1S778oTZT+1Y8OvW8LxsHnG92dC1tC65Pqs3Fnqi50ImOB6GxR8rhq1McegdJquJv9gbGOA/h1gTBj6BiJ2jxI2l5TdyS5XQNRI07GkVsCq4fpWDFUkgl9lf26sBjbSHIprE24U3ygK/QGtcN7WVgxj4tj3N6OxV1qCBeOOuweyb90nDQajGBZ9G0UFFLWV2t+EGJqSRSmIkvLAvPvZG0v7jUTWSis4C9KcxvoFHAjSVw0xpGL6TKw0pFII3jeeFpw+V3dH2dc04fzSiRPx/yzgeSx7o3eaOcy208qyYsI4h6YN5WCH9HYIFBv1wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/Web-sample/my/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/Web-sample/my/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";//"https://openapi.alipay.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

